<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="../../../header.jsp"%>

<script type="text/javascript">
var childrenLoaded = false;

/**
 * 返回前一页。对于弹出窗口或前一页是登录窗口的，返回指定的连接
 */
function goBack1(){
	if(window.opener != undefined || document.referrer.indexOf("login.html") > 0 
			|| document.referrer.indexOf("template/edit.do") > 0){
		location.href = "./";
		return;
	}
	history.go(-1);
}

function saveSucceedCallback(data) {
	unblock("#detailForm");
	if (!data.succeed) {
		$.notice("保存失败，原因为：\n"+data.message);
		return;
	}
	$.info("保存成功！");
}

function loadChildren(){
	if(childrenLoaded){
		return;
	}
	childrenLoaded = true;
	
	var id = $("#id").val();
	$.ajax({
		type: "GET",
		cache: false,
		url: "children.json?id=" + id,
		dataType: "json",
		success: loadChildrenSucceedCallback,
		error:function(message){
			$.alert(message);
		}
	});
}

$(document).ready(function() {
//	$("#tabs").tab("show");
	$('a[data-toggle="tab"]').on('shown', function (e) {
		var actived = $(e.target).attr("href");
		if(actived == "#photoPanel"){
			loadChildren();
		}
	});
});
</script>

<div class="left">
<div class="border bg">

<div class="page-header">
<h2>编辑模板<small id="taskTitle"></small></h2>
</div>


<div id="tabs">
<ul class="nav nav-tabs">
<li class="active"><a href="#detailPanel" data-toggle="tab">基本信息</a></li>
<li><a href="#childPanel" data-toggle="tab">工序列表</a></li>
</ul>

<div class="tab-content">
<div id="detailPanel" class="tab-pane fade in active">
	<%@ include file="edit.detail.jsp"%>
</div>

<div id="childPanel" class="tab-pane fade">
	<%@ include file="edit.children.jsp"%>
</div>

</div>
</div>
</div>
</div>


<%@ include file="../../../footer.jsp"%>